Handle scalar rows in CSV export - #224
Open
Mike Krüger (mkrueger) wants to merge 1 commit into
Open
Mike Krüger (mkrueger) wants to merge 1 commit into
Mike Krüger (mkrueger) wants to merge 1 commit into
Conversation
Add a value column for non-object CSV export rows so scalar and mixed query results keep their data while preserving existing object row behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mike Krüger (mkrueger)
requested review from
a team
and
a balanced review from Copilot
September 29, 2026 12:56
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted implementation matches existing rendering behavior and is adequately documented and tested.
Review effort: Balanced
Findings: None
What changed in this PR
Adds CSV export support for scalar and mixed query results.
Changes:
- Writes non-object rows to a
valuecolumn. - Preserves object-only behavior and supports mixed rows.
- Adds documentation and comprehensive tests.
| File | Description |
|---|---|
docs/commands.md |
Documents scalar and mixed CSV output. |
ExportCommand.cs |
Adds scalar-value column generation. |
ExportCommandTests.cs |
Covers scalar, object, array, and mixed rows. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
export --format=csvcollected CSV headers only from JSON object properties. Rows whose value is not an object (for exampleexport out.csv --format=csv --query="SELECT VALUE c.id FROM c", or numbers, booleans, null, arrays) were written as empty lines, while the command still reported the exported row count.Change
valuecolumn, matching the existing scalar CSV rendering inCommandState.Table.cs(JsonElement.ToString()escaped withCommandState.EscapeCSV).valuecolumn, so no row loses data.docs/commands.mddescribes thevaluecolumn and the mixed case.Tests in
ExportCommandTestscover scalar strings that need escaping, numbers, booleans, null, arrays, object-only rows, and mixed rows.